﻿using Google.Cloud.Translation.V2;
using Microsoft.AspNetCore.Mvc;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace WebAppGoogleTranslation.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class GoogleTranslateController : Controller
    {
        private readonly IGoogleTranslateAppService _googleTranslateAppService;
        public GoogleTranslateController(IGoogleTranslateAppService googleTranslateAppService)
        {
            _googleTranslateAppService = googleTranslateAppService;
        }

        [HttpGet]
        public async Task<IEnumerable<Language>> GetLanguages()
        {
            return await _googleTranslateAppService.GetLanguagesAsync();
        }
        
        [HttpGet]
        [Route("getLanguagesApi")]
        public async Task<IEnumerable<Language>> GetLanguagesApiAsync()
        {
            return await _googleTranslateAppService.GetLanguagesApiAsync();
        }
    }
}
